package com.ks.core.framework.cpsupload.demos.orderpayinvoice.orderhandler;

import com.ks.core.framework.cpsupload.demos.orderpayinvoice.constant.OrderStatus;

import java.util.EnumMap;
import java.util.Map;

// 订单状态管理器
class OrderStateManager {
    private static final Map<OrderStatus, OrderStateHandler> handlers = new EnumMap<>(OrderStatus.class);
    
    static {
        handlers.put(OrderStatus.PAID, new PaidStateHandler());
        handlers.put(OrderStatus.REFUNDED, new RefundedStateHandler());
        handlers.put(OrderStatus.PARTIALLY_REFUNDED, new PartialRefundHandler());
        // 其他状态处理...
    }
    
    public static void handleStateChange(Order order) {
        OrderStateHandler handler = handlers.get(order.getStatus());
        if (handler != null) {
            handler.handle(order);
        }
    }
}